www.gusucode.com > Simulink library for Arduino Liquid Crystal Display 程序工具箱matlab源码 > Simulink library for Arduino Liquid Crystal Display/Arduino_LCD_Driver/src/LCD_wrapper.cpp
/* % % Copyright 2018, The MathWorks Inc. % % */ #if ( defined(MATLAB_MEX_FILE) || defined(RSIM_PARAMETER_LOADING) || defined(RSIM_WITH_SL_SOLVER) ) #else #include "LiquidCrystal.h" #include "LCD_wrapper.h" #include "Arduino.h" #include <stdint.h> #include "rtwtypes.h" LiquidCrystal *lcd; extern "C" void MW_LCD_Init(unsigned int rs, unsigned int en, unsigned int d0, unsigned int d1, unsigned int d2, unsigned int d3){ // lcd = new LiquidCrystal(50,3,4,51,5,48); lcd = new LiquidCrystal(rs,en,d0,d1,d2,d3); unsigned int cols = 16; unsigned int rows = 2; lcd->begin(cols, rows); lcd->print("Welcome"); } extern "C" void MW_Print_LCD(char up[],char s[]){ unsigned int d4 = 100; lcd->clear(); unsigned int cols = 0; unsigned int rows = 0; lcd->setCursor(cols,rows); lcd->print(up); rows = rows + 1; lcd->setCursor(cols,rows); lcd->print(s); } #endif